// reducers/index.ts
import { combineReducers } from 'redux';
import { UserState, CartState } from '../types';
import { userReducer } from './user';
import { cartReducer } from './cart';
 
// 合并 reducer：key 为状态模块名称，value 为对应 reducer
const rootReducer = combineReducers({
  user: userReducer,
  cart: cartReducer,
});
 
// 导出根状态类型（自动由 combineReducers 推导，也可手动定义）
export type RootState = {
  user: UserState;
  cart: CartState;
};
 
export default rootReducer;